//
//  ViewController.m
//  文印室
//
//  Created by KL on 17/2/21.
//  Copyright © 2017年 KM. All rights reserved.
//

#import "ViewController.h"
#import "View2Controller.h"
#import "DataChe.h"
#import "BmData.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *userName;
@property (weak, nonatomic) IBOutlet UITextField *password;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)onClick:(id)sender {
    [DataChe loginWithName:_userName.text WithPassword:_password.text complete:^(NSDictionary *d) {
        BmData *data = [[BmData alloc] initWithDictionary:d];
        //NSLog(@"+++%@",data.errcode);
        if (data.errcode != 0) {
            return ;
        }else {
            UIViewController *view2 = [self.storyboard instantiateViewControllerWithIdentifier:@"nav2"];
            [self presentViewController:view2 animated:YES completion:nil];
               }
        }
    ];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
